package com.cainaer.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cainaer.common.core.utils.StringUtils;
import com.cainaer.shop.domain.CateType;
import com.cainaer.shop.mapper.CateTypeMapper;
import com.cainaer.shop.service.ICateTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

/**
 * <p>
 * 门店类型 服务实现类
 * </p>
 *
 * @author Tina
 * @since 2020-09-03
 */
@Service
public class CateTypeServiceImpl extends ServiceImpl<CateTypeMapper, CateType> implements ICateTypeService {


    @Autowired
    private CateTypeMapper cateTypeMapper;

    /**
     * 查询门店营业类型
     *
     * @param cateType
     * @return
     */
    @Override
    public List<CateType> queryCateType(CateType cateType) {
        QueryWrapper wrapper = new QueryWrapper();
        if (StringUtils.isNotEmpty(cateType.getCareName())) {
            wrapper.like("care_name", cateType.getCareName());
        }

        return cateTypeMapper.selectList(wrapper);
    }

    /**
     * 通过经营ID查询
     *
     * @param careId
     * @return
     */
    @Override
    public CateType selectCateTypeById(Long careId) {

        return cateTypeMapper.selectById(careId);
    }
}
